package com.atguigu.spzx.exception;

import com.atguigu.spzx.spzx.model.vo.common.Result;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

import java.sql.SQLException;

@RestControllerAdvice
public class GuiguException {
    @ExceptionHandler(value = Exception.class)
    public Result handException(Exception exception){
        return Result.error().message(exception.getMessage());
    }


    @ExceptionHandler(value = SQLException.class)
    public Result handSQLException(SQLException sqlException){
        return Result.error().message(sqlException.getMessage());
    }
}
